package com.cy.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cy.entity.Admin;
import com.cy.entity.AdminExample;
import com.cy.mapper.AdminMapper;

@Service
public class AdminService {
	@Autowired
	private AdminMapper mapper;
	
	public 	List<Admin> findAllAdmin(){
		return mapper.selectByExample(null);
	}
	
	public Admin findAdminById(Integer id) {
		return mapper.selectByPrimaryKey(id);
		
	}
	
	public List<Admin> login(String tel, String password) {
		AdminExample ae= new AdminExample();
		ae.createCriteria().andAdmintelEqualTo(tel).andPasswordEqualTo(password);
		List<Admin> list = mapper.selectByExample(ae);
		return list;
	}
}
